﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0040)http://flyls.yo2.cn/articles/sudoku.html -->
<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>izz&ilife // once upon a time</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8"><LINK 
media=screen href="izz&amp;ilife -- once upon a time.files/style.css" 
type=text/css rel=stylesheet><!--[if lt IE 8]><LINK media=screen 
href="izz&amp;ilife -- once upon a time.files/ie.css" type=text/css 
rel=stylesheet>
<SCRIPT src="izz&amp;ilife -- once upon a time.files/IE8.js" 
type=text/javascript></SCRIPT>
<![endif]--><LINK media=print 
href="izz&amp;ilife -- once upon a time.files/print.css" type=text/css 
rel=stylesheet><LINK title=Home href="http://flyls.yo2.cn" rel=start><LINK 
title="izz&amp;ilife RSS Feed" href="http://flyls.yo2.cn/feed" 
type=application/rss+xml rel=alternate><LINK 
href="http://flyls.yo2.cn/xmlrpc.php" rel=pingback><LINK title=RSD 
href="http://flyls.yo2.cn/xmlrpc.php?rsd" type=application/rsd+xml 
rel=EditURI><LINK href="http://extra-001.yo2cdn.com/wp-includes/wlwmanifest.xml" 
type=application/wlwmanifest+xml rel=wlwmanifest>
<META content="MSHTML 6.00.2900.5897" name=GENERATOR>
<STYLE type=text/css>#fp:first-letter {
	FONT-WEIGHT: bold; FONT-SIZE: 260%; FLOAT: left; TEXT-TRANSFORM: uppercase; MARGIN-RIGHT: 6px
}
</STYLE>
<LINK href="http://flyls.yo2.cn/favicon.ico" type=image/x-icon 
rel="shortcut icon"><!-- Google Analytics for WordPress | http://yoast.com/wordpress/google-analytics/ -->
<SCRIPT type=text/javascript>
		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
		document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	</SCRIPT>

<SCRIPT type=text/javascript>
		var pageTracker = _gat._getTracker("UA-11116433-1");
	</SCRIPT>

<SCRIPT type=text/javascript>
		pageTracker._initData();
		
		pageTracker._trackPageview();
	</SCRIPT>
<!-- End of Google Analytics code --></HEAD>
<BODY class=sudoku id=interior>
<DIV id=container><A id=rssfeed title="RSS 2.0 Feed" 
href="http://flyls.yo2.cn/feed">RSS Feed</A> 
<DIV class=clearfix id=header>
<H1><A href="http://flyls.yo2.cn/">izz&amp;ilife</A> <SPAN>once upon a 
time</SPAN></H1>
<UL id=nav>
  <LI><A href="http://flyls.yo2.cn/">Home</A> </LI>
  <LI class=last>
  <FORM action=http://flyls.yo2.cn/ method=get>
  <FIELDSET><INPUT id=s name=s> <INPUT id=submit type=submit value=Search name=submit> </FIELDSET> 
</FORM></LI></UL></DIV>
<DIV class=clearfix id=main>
<DIV id=content>
<DIV class=inner>
<DIV class=mainbg>
<DIV class=calendar><SMALL>十</SMALL> <STRONG>8</STRONG></DIV>
<H1 class=post><A id=post-5102 title="Permanent Link to sudoku" 
href="http://flyls.yo2.cn/articles/sudoku.html" rel=bookmark>sudoku</A></H1>
<DIV class=bottombg>
<DIV class=posted>Posted on <SPAN>星期四, 十月 8, 2009</SPAN> in <SPAN><A 
title="查看 algorithm 的全部文章" 
href="http://flyls.yo2.cn/articles/category/algorithm" 
rel="category tag">algorithm</A></SPAN></DIV>
<P>
<DIV 
id=fp>图</DIV>书馆的《编程之美－微软技术面试心得》一直只有一本保存本，上次去的时候，终于发现多出了一本可外借的。于是拿回来仔细地看了看，书很不错，上面有的算法让人有“从山阴<I 
style="DISPLAY: none">及豪华像酒店的住宅区、成年人的游乐场与难得的免费公园。将它们贯通的则是曲折的街巷，用铅笔在城市地图上标出，它们</I>道上行，山川自相映发，使人应接不暇”的感觉。有一篇是说数独的，记得去年还有个大学生数独什么比赛的，那时我就在想怎么用计算机来解。下图是linux下Gnome的一个数独游戏：
<P></P>
<P><IMG class="aligncenter size-full wp-image-5334" title=screenshot1 height=358 
alt=screenshot1 src="izz&amp;ilife -- once upon a time.files/screenshot1.jpg" 
width=500></P>
<P>书上给出了用深度优先搜索的方法生成数独的伪代码，算法的思想跟用回溯法解八皇后问题基本一致——即从坐标点(0,0)开始，对于没有处理过的格子，调用函数来获得当前格子的可能的取值选择，并从中取一个为当前格子的取值，接着搜索下一个格子。在搜索过程中，若出现某个格子没有可行的取值，则回溯，修改前一个格子的取值。直到所有的格子都找到可行的取值为止，这样就生成了一个可行解。然后随机挖掉一些格子，就生成了一个数独。下面是c/c++源代码：</P><PRE class=code><SPAN style="COLOR: blue">#include</SPAN><SPAN style="COLOR: #a31515">&lt;iostream&gt;
</SPAN><SPAN style="COLOR: blue">#include</SPAN><SPAN style="COLOR: #a31515">&lt;stdio.h&gt;
</SPAN><SPAN style="COLOR: blue">#include</SPAN><SPAN style="COLOR: #a31515">&lt;stdlib.h&gt;
</SPAN><SPAN style="COLOR: blue">#include</SPAN><SPAN style="COLOR: #a31515">&lt;time.h&gt;
</SPAN><SPAN style="COLOR: blue">using namespace </SPAN>std;
<SPAN style="COLOR: blue">class </SPAN>CSudoku
{
<SPAN style="COLOR: blue">private</SPAN>:
    <SPAN style="COLOR: blue">int </SPAN>map[9][9];
    <SPAN style="COLOR: blue">int </SPAN>smod;
    <SPAN style="COLOR: blue">int </SPAN>solves;
    <SPAN style="COLOR: blue">int </SPAN>check(<SPAN style="COLOR: blue">int</SPAN>,<SPAN style="COLOR: blue">int</SPAN>,<SPAN style="COLOR: blue">int</SPAN>*);
    <SPAN style="COLOR: blue">void </SPAN>dfs();
<SPAN style="COLOR: blue">public</SPAN>:
    <SPAN style="COLOR: blue">enum</SPAN>{ANY=0,ALL=1};<SPAN style="COLOR: green">//枚举类型
    </SPAN>CSudoku(<SPAN style="COLOR: blue">int </SPAN>n=40);<SPAN style="COLOR: green">//空格数
    </SPAN><SPAN style="COLOR: blue">void </SPAN>display();<SPAN style="COLOR: green">// 显示数独
    </SPAN><SPAN style="COLOR: blue">int </SPAN>resolve(<SPAN style="COLOR: blue">int </SPAN>mod=ALL);<SPAN style="COLOR: green">// 解数独
    //CSudoku(int *data);//解指定的数独
</SPAN>};
CSudoku::CSudoku(<SPAN style="COLOR: blue">int </SPAN>n)
{
    <SPAN style="COLOR: blue">int </SPAN>i,j;
    srand(time(0));
    <SPAN style="COLOR: blue">do
    </SPAN>{
        <SPAN style="COLOR: blue">for</SPAN>(i=0;i&lt;9;++i)
        {
            <SPAN style="COLOR: blue">for</SPAN>(j=0;j&lt;9;++j)
                map[i][j]=0;<SPAN style="COLOR: green">//第i行先置0
            </SPAN>j=rand()%9;//j=0~8<SPAN style="COLOR: green">
            </SPAN>map[i][j]=i+1;<FONT color=#008000>//第1行随便找一列填1，第2行填2...第9行填9</FONT>
        }
    }<SPAN style="COLOR: blue">while</SPAN>(!resolve(ANY));<BR>
    <SPAN style="COLOR: green">//dig holes
    </SPAN><SPAN style="COLOR: blue">for</SPAN>(<SPAN style="COLOR: blue">int </SPAN>k=0;k&lt;n;)<SPAN style="COLOR: green">//n represent the number of blank, the position of 0 is random
    </SPAN>{
        i=rand()%81;<SPAN style="COLOR: green">//i=0~80
        </SPAN>j=i%9;<SPAN style="COLOR: green">//j=0~8
        </SPAN>i=i/9;<SPAN style="COLOR: green">//i=0~8
        </SPAN><SPAN style="COLOR: blue">if</SPAN>(map[i][j]&gt;0)
        {
            map[i][j]=0;
            ++k;
        }<BR>
    }
    cout&lt;&lt;<SPAN style="COLOR: #a31515">"randomized sudoku created with "</SPAN>&lt;&lt;n&lt;&lt;<SPAN style="COLOR: #a31515">" blanks"</SPAN>&lt;&lt;endl;
}
<SPAN style="COLOR: green">/*CSudoku::CSudoku(int *data)
{
int *pm=(int*)map;
for(int i=0;i&lt;81;++i)
pm[i]=data[i];
}*/
//解指定数独，暂时不用
</SPAN><SPAN style="COLOR: blue">void </SPAN>CSudoku::display()
{
    <SPAN style="COLOR: blue">for</SPAN>(<SPAN style="COLOR: blue">int </SPAN>i=0;i&lt;9;++i)
    {
        <SPAN style="COLOR: blue">for</SPAN>(<SPAN style="COLOR: blue">int </SPAN>j=0;j&lt;9;++j)
        {
            <SPAN style="COLOR: blue">if</SPAN>(map[i][j]&gt;0)
                cout&lt;&lt;<SPAN style="COLOR: #a31515">"&lt;"</SPAN>&lt;&lt;map[i][j]&lt;&lt;<SPAN style="COLOR: #a31515">"&gt;"</SPAN>&lt;&lt;<SPAN style="COLOR: #a31515">" "</SPAN>;
            <SPAN style="COLOR: blue">else
                </SPAN>cout&lt;&lt;<SPAN style="COLOR: #a31515">"[ ] "</SPAN>;
        }
        cout&lt;&lt;<SPAN style="COLOR: #a31515">"n"</SPAN>;
    }
}
<SPAN style="COLOR: blue">int </SPAN>CSudoku::resolve(<SPAN style="COLOR: blue">int </SPAN>mod)<SPAN style="COLOR: green">//enum all, any
</SPAN>{
    smod=mod;<BR>
    <SPAN style="COLOR: blue">if</SPAN>(mod==ALL)<SPAN style="COLOR: green">//all就是搜出全部解，开始解，any就是搜出任一个解
    </SPAN>{
        solves=0;
        dfs();
        <SPAN style="COLOR: blue">return </SPAN>solves;
    }
    <SPAN style="COLOR: blue">else if</SPAN>(mod==ANY)<SPAN style="COLOR: green">//填出题的那个数独
    </SPAN>{
        <SPAN style="COLOR: blue">try
        </SPAN>{
            dfs();
            <SPAN style="COLOR: blue">return </SPAN>0;
        }
        <SPAN style="COLOR: blue">catch</SPAN>(<SPAN style="COLOR: blue">int</SPAN>)
        {
            <SPAN style="COLOR: blue">return </SPAN>1;<SPAN style="COLOR: green">//执行到im=-1就表示出题成功了
        </SPAN>}
    }
    <SPAN style="COLOR: blue">return </SPAN>0;
}
<SPAN style="COLOR: blue">int </SPAN>CSudoku::check(<SPAN style="COLOR: blue">int </SPAN>x,<SPAN style="COLOR: blue">int </SPAN>y,<SPAN style="COLOR: blue">int </SPAN>*mark)
{
    <SPAN style="COLOR: blue">int </SPAN>i,j,is,js,count=0;<SPAN style="COLOR: green">//map[x][y]=0
    </SPAN><SPAN style="COLOR: blue">for</SPAN>(i=1;i&lt;=9;++i)
        mark[i]=0;<SPAN style="COLOR: green">//擦标记
    </SPAN><SPAN style="COLOR: blue">for</SPAN>(i=0;i&lt;9;++i)
        mark[map[x][i]]=1;<SPAN style="COLOR: green">//表示x行所有出现过的元素都不能用了
    </SPAN><SPAN style="COLOR: blue">for</SPAN>(i=0;i&lt;9;++i)
        mark[map[i][y]]=1;<SPAN style="COLOR: green">//表示y列所有出现过的元素都不能用了
    </SPAN>is=x/3*3;
    js=y/3*3;
    <SPAN style="COLOR: blue">for</SPAN>(i=0;i&lt;3;++i)
    {
        <SPAN style="COLOR: blue">for</SPAN>(j=0;j&lt;3;++j)
            mark[map[is+i][js+j]]=1;
    }<SPAN style="COLOR: green">//标记在3*3的格子中元素占用情况
    </SPAN><SPAN style="COLOR: blue">for</SPAN>(i=1;i&lt;=9;++i)
        <SPAN style="COLOR: blue">if</SPAN>(mark[i]==0)
            count++;
    <SPAN style="COLOR: blue">return </SPAN>count;
}
<SPAN style="COLOR: blue">void </SPAN>CSudoku::dfs()
{
    <SPAN style="COLOR: blue">int </SPAN>i,j,im=-1,jm,min=10;
    <SPAN style="COLOR: blue">int </SPAN>mark[10];
    <SPAN style="COLOR: blue">for</SPAN>(i=0;i&lt;9;++i)
    {
        <SPAN style="COLOR: blue">for</SPAN>(j=0;j&lt;9;++j)
        {
            <SPAN style="COLOR: blue">if</SPAN>(map[i][j])
                <SPAN style="COLOR: blue">continue</SPAN>;<SPAN style="COLOR: green">//所在位置上已有数字则跳过
            </SPAN><SPAN style="COLOR: blue">int </SPAN>c=check(i,j,mark);<SPAN style="COLOR: green">//如果没填则检查其自由度
            </SPAN><SPAN style="COLOR: blue">if</SPAN>(c==0)
                <SPAN style="COLOR: blue">return</SPAN>;
            <SPAN style="COLOR: blue">if</SPAN>(c&lt;min)<SPAN style="COLOR: green">//如果自由度一样就不理它
            </SPAN>{
                im=i;
                jm=j;
                min=c;
            }
        }
    }
    <SPAN style="COLOR: blue">if</SPAN>(im==-1)
    {
        <SPAN style="COLOR: blue">if</SPAN>(smod==ALL)<SPAN style="COLOR: green">//搜到所有解才停止
        </SPAN>{
            cout&lt;&lt;<SPAN style="COLOR: #a31515">"No."</SPAN>&lt;&lt;++solves&lt;&lt;endl;
            display();
            <SPAN style="COLOR: blue">return</SPAN>;<SPAN style="COLOR: green">//
        </SPAN>}<BR>
        <SPAN style="COLOR: blue">else if</SPAN>(smod==ANY) <SPAN style="COLOR: green">//搜到一个解就停止
        </SPAN>{<BR>
            <SPAN style="COLOR: blue">throw</SPAN>(1);
        }
    }
    check(im,jm,mark);
    <SPAN style="COLOR: blue">for</SPAN>(i=1;i&lt;=9;++i)
    {
        <SPAN style="COLOR: blue">if</SPAN>(mark[i]==0)
        {
            map[im][jm]=i;
            dfs();
        }
    }
    map[im][jm]=0;<SPAN style="COLOR: green">//回溯
</SPAN>}<BR>
}
<SPAN style="COLOR: blue">int </SPAN>main()
{
    <SPAN style="COLOR: green">/*int data1[]=
    {4,9,0,0,0,0,0,2,7,
    5,0,0,0,1,0,0,0,4,
    6,0,0,0,0,8,0,0,3,
    1,0,4,0,0,0,0,0,0,
    0,6,0,0,0,0,0,5,0,
    0,0,0,0,0,0,2,0,8,
    7,0,0,2,0,0,0,0,5,
    8,0,0,0,9,0,0,0,1,
    3,4,0,5,0,0,0,6,2
    };
    int data2[]=
    {7,4,0,0,8,0,0,1,6,
    9,0,0,0,3,5,0,0,4,
    0,0,0,7,0,0,0,0,0,
    0,7,0,0,0,9,5,0,0,
    6,1,0,0,5,0,0,8,7,
    0,0,2,6,0,0,0,4,0,
    0,0,0,0,0,4,0,0,0,
    3,0,0,5,6,0,0,0,2,
    5,6,0,0,1,0,0,3,9
    };*/
    //指定的数独
    </SPAN>cout&lt;&lt;<SPAN style="COLOR: #a31515">"随机生成一个数独，请输入空格数："</SPAN>;
    <SPAN style="COLOR: blue">int </SPAN>blanks;
    cin&gt;&gt;blanks;
    CSudoku s(blanks);<SPAN style="COLOR: green">//构造数独
    </SPAN>s.display();
    cout&lt;&lt;<SPAN style="COLOR: #a31515">"开始解数独:"</SPAN>&lt;&lt;endl;
    s.resolve();
    <SPAN style="COLOR: blue">return </SPAN>0;
}
</PRE>
<P><A 
onclick="javascript:pageTracker._trackPageview('/outbound/article/11011.net');" 
href="http://11011.net/software/vspaste"></A></P>
<P>这是在gcc上编译通过并运行的截图:<IMG class="aligncenter size-full wp-image-10414" 
title=sudoku height=361 alt=sudoku 
src="izz&amp;ilife -- once upon a time.files/sudoku.jpg" 
width=500>至于具备可玩性的图形界面版本，其实编写也不难，无非就是安排一些图形组件，然后写事件驱动程序(java)。用MFC写了个图形化的，主要是鼠标单击的范围判断，处理鼠标消息响应，然后贴图，窗口重绘。没有学过qt或是gtk的编程，在linux下也只能用java写个图形化的。</P>
<P>回到算法这儿来，其实这个还是最重要的，以后将继续讨论其他的解法。</P>
<P id=tags>标签：<A href="http://flyls.yo2.cn/articles/tag/c" rel=tag>c++</A>, <A 
href="http://flyls.yo2.cn/articles/tag/åæº¯" rel=tag>回溯</A>, <A 
href="http://flyls.yo2.cn/articles/tag/æ°ç¬" rel=tag>数独</A>, <A 
href="http://flyls.yo2.cn/articles/tag/ç®æ³" rel=tag>算法</A><BR></P>
<DIV class=postfooter><SPAN id=_edit_post_link5102></SPAN>
<SCRIPT language=javascript>if(document.cookie.indexOf("BOWNER")!=-1)document.getElementById("_edit_post_link5102").innerHTML='<a class="post-edit-link" href="http://flyls.yo2.cn/wp-admin/post.php?action=edit&amp;post=5102" title="编辑文章">Edit</a>';</SCRIPT>
<SPAN class=tags>Tags: <A href="http://flyls.yo2.cn/articles/tag/c" 
rel=tag>c++</A>, <A href="http://flyls.yo2.cn/articles/tag/åæº¯" 
rel=tag>回溯</A>, <A href="http://flyls.yo2.cn/articles/tag/æ°ç¬" 
rel=tag>数独</A>, <A href="http://flyls.yo2.cn/articles/tag/ç®æ³" 
rel=tag>算法</A></SPAN> </DIV></DIV>
<DIV class=navigation>
<DIV class=alignleft>« <A href="http://flyls.yo2.cn/articles/4712.html">beat 
it</A></DIV>
<DIV class=alignright><A 
href="http://flyls.yo2.cn/articles/still-sudoku.html">还是sudoku</A> »</DIV></DIV><!-- You can start editing here. -->
<DIV class=clearfix id=comments>
<H2>Bring on the comments</H2>
<OL>
  <LI class="alt item" id=comment-3078>
  <DIV class=commentmetadata><IMG class="avatar avatar-48 photo" height=48 
  alt="" src="izz&amp;ilife -- once upon a time.files/88x88" width=48> 
  <STRONG><A class=url 
  onclick="javascript:pageTracker._trackPageview('/outbound/commentauthor/sites.google.com');" 
  href="http://sites.google.com/" 
  rel="external nofollow">匿名</A></STRONG><BR><SMALL><A title="" 
  href="http://flyls.yo2.cn/articles/sudoku.html#comment-3078">星期四, 十月 8 11:10 
  下午</A> <SPAN id=_edit_comment_link3078></SPAN>
  <SCRIPT language=javascript>if(document.cookie.indexOf("BOWNER")!=-1)document.getElementById("_edit_comment_link3078").innerHTML='<a class="comment-edit-link" href="http://flyls.yo2.cn/wp-admin/comment.php?action=editcomment&amp;c=3078" title="编辑评论">e</a>';</SCRIPT>
  </SMALL></DIV>
  <DIV class=comment-body>
  <P>应该首页限定字数多少，以及“查看全部”按钮，利于排版。</P>
  <P>话说你的处<U 
  style="DISPLAY: none">间是灰色偏暗的楼道。光线低沉，半天了都没人在楼道出现。三到五层以及第八层楼道口安有小牛奶箱，绿色房子造型，透过</U>女勃，就这样被我SF了。</P></DIV></LI></OL>
<H3>Leave a Comment</H3>
<FORM id=commentform action=http://flyls.yo2.cn/wp-comments-post.php 
method=post>
<FIELDSET id=comment-author><LABEL for=author>Name </LABEL><INPUT id=author 
tabIndex=1 size=22 name=author> <LABEL for=email>Mail (will not be published) 
</LABEL><INPUT id=email tabIndex=2 size=22 name=email> <LABEL 
for=url>Website</LABEL> <INPUT id=url tabIndex=3 size=22 name=url> </FIELDSET> 
<FIELDSET id=comment-text>
<P>
<SCRIPT 
language=javascript>var COOKIEHASH = '27c548457a3a63a48ff2fec602b7d49d';</SCRIPT>

<SCRIPT language=javascript 
src="izz&amp;ilife -- once upon a time.files/infos.js"></SCRIPT>
<TEXTAREA id=comment tabIndex=4 name=comment rows=10 cols=45></TEXTAREA></P>
<P><INPUT id=submit_comment tabIndex=5 type=submit value="Submit Comment" name=submit_comment> 
<INPUT type=hidden value=5102 name=comment_post_ID> </P><!--<p><small><strong>XHTML:</strong> You can use these tags: &lt;a href=&quot;&quot; title=&quot;&quot;&gt; &lt;abbr title=&quot;&quot;&gt; &lt;acronym title=&quot;&quot;&gt; &lt;b&gt; &lt;blockquote cite=&quot;&quot;&gt; &lt;cite&gt; &lt;code&gt; &lt;del datetime=&quot;&quot;&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=&quot;&quot;&gt; &lt;strike&gt; &lt;strong&gt; </small></p>--></FIELDSET> 
</FORM></DIV></DIV></DIV></DIV>
<DIV id=sidebar>
<DIV class=main>
<DIV class=middle>
<DIV class=bottom>
<DIV class=textwidget>
<SCRIPT src="izz&amp;ilife -- once upon a time.files/display2.js" 
type=text/javascript></SCRIPT>
</DIV></DIV></DIV></DIV>
<DIV class=main>
<DIV class=middle>
<DIV class=bottom>
<H2>分类目录</H2>
<UL>
  <LI class="cat-item cat-item-1773"><A title="查看 algorithm 下的所有文章" 
  href="http://flyls.yo2.cn/articles/category/algorithm">algorithm</A> 
  <LI class="cat-item cat-item-1694"><A title="查看 feeling 下的所有文章" 
  href="http://flyls.yo2.cn/articles/category/feeling">feeling</A> 
  <LI class="cat-item cat-item-4817"><A title="查看 linux 下的所有文章" 
  href="http://flyls.yo2.cn/articles/category/linux">linux</A> 
  <LI class="cat-item cat-item-5588"><A title="查看 python 下的所有文章" 
  href="http://flyls.yo2.cn/articles/category/python">python</A> 
  <LI class="cat-item cat-item-4270"><A title="查看 wordpress 下的所有文章" 
  href="http://flyls.yo2.cn/articles/category/wordpress">wordpress</A> 
  <LI class="cat-item cat-item-1331"><A title="查看 未分类 下的所有文章" 
  href="http://flyls.yo2.cn/articles/category/uncategorized">未分类</A> 
</LI></UL></DIV></DIV></DIV>
<DIV class=main>
<DIV class=middle>
<DIV class=bottom>
<H2>标签</H2><A class=tag-link-4662 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/åæº¯" rel=tag>回溯</A> <A 
class=tag-link-4656 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/å¹é" rel=tag>幂集</A> <A 
class=tag-link-4661 title="3 topics" style="FONT-SIZE: 22pt" 
href="http://flyls.yo2.cn/articles/tag/æ°ç¬" rel=tag>数独</A> <A 
class=tag-link-4657 title="3 topics" style="FONT-SIZE: 22pt" 
href="http://flyls.yo2.cn/articles/tag/ç®æ³" rel=tag>算法</A> <A 
class=tag-link-4674 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/ç²¾ç¡®è¦ç" rel=tag>精确覆盖</A> <A 
class=tag-link-4655 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/ç»å" rel=tag>组合</A> <A 
class=tag-link-4819 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/ç¼©è¿" rel=tag>缩进</A> <A 
class=tag-link-4658 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/éå½" rel=tag>递归</A> <A 
class=tag-link-4653 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/é¦å&shy;ä¸æ²" rel=tag>首字下沉</A> <A 
class=tag-link-4670 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/art" rel=tag>art</A> <A 
class=tag-link-4675 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/beat-it" rel=tag>beat&nbsp;it</A> <A 
class=tag-link-4669 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/beauty" rel=tag>beauty</A> <A 
class=tag-link-5080 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/bfs" rel=tag>BFS</A> <A 
class=tag-link-4272 title="3 topics" style="FONT-SIZE: 22pt" 
href="http://flyls.yo2.cn/articles/tag/c" rel=tag>c++</A> <A class=tag-link-4671 
title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/dancing-links" 
rel=tag>dancing&nbsp;links</A> <A class=tag-link-5079 title="1 topics" 
style="FONT-SIZE: 8pt" href="http://flyls.yo2.cn/articles/tag/dfs" 
rel=tag>DFS</A> <A class=tag-link-4673 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/dlx" rel=tag>DLX</A> <A 
class=tag-link-4672 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/donald-e-knuth" 
rel=tag>Donald&nbsp;E.&nbsp;Knuth</A> <A class=tag-link-5539 title="1 topics" 
style="FONT-SIZE: 8pt" href="http://flyls.yo2.cn/articles/tag/fedora12" 
rel=tag>fedora12</A> <A class=tag-link-4677 title="1 topics" 
style="FONT-SIZE: 8pt" href="http://flyls.yo2.cn/articles/tag/ilife" 
rel=tag>ilife</A> <A class=tag-link-4817 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/linux" rel=tag>linux</A> <A 
class=tag-link-5356 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/live-writer" rel=tag>live&nbsp;writer</A> 
<A class=tag-link-4676 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/mj" rel=tag>MJ</A> <A class=tag-link-7157 
title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/nmet" rel=tag>nmet</A> <A 
class=tag-link-4654 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/opera" rel=tag>opera</A> <A 
class=tag-link-5588 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/python" rel=tag>python</A> <A 
class=tag-link-5589 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/re" rel=tag>re</A> <A class=tag-link-4663 
title="2 topics" style="FONT-SIZE: 15pt" 
href="http://flyls.yo2.cn/articles/tag/sudoku" rel=tag>sudoku</A> <A 
class=tag-link-5357 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/syntax-highlight" 
rel=tag>syntax&nbsp;highlight</A> <A class=tag-link-5538 title="1 topics" 
style="FONT-SIZE: 8pt" href="http://flyls.yo2.cn/articles/tag/ubuntu910" 
rel=tag>ubuntu9.10</A> <A class=tag-link-4270 title="1 topics" 
style="FONT-SIZE: 8pt" href="http://flyls.yo2.cn/articles/tag/wordpress" 
rel=tag>wordpress</A> <A class=tag-link-4664 title="1 topics" 
style="FONT-SIZE: 8pt" href="http://flyls.yo2.cn/articles/tag/wordpressæä»¶" 
rel=tag>wordpress插件</A> <A class=tag-link-4818 title="1 topics" 
style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/yo2ä»£ç&nbsp;é«äº®" rel=tag>yo2代码高亮</A> 
<A class=tag-link-4652 title="1 topics" style="FONT-SIZE: 8pt" 
href="http://flyls.yo2.cn/articles/tag/yo2" rel=tag>yo2</A></DIV></DIV></DIV>
<DIV class=main>
<DIV class=middle>
<DIV class=bottom>
<H2><A href="http://blog.yo2.cn/register/" target=_blank>免费注册博客</A></H2>
<CENTER id=yo2powered><EMBED style="WIDTH: 50%" 
src=http://home.yo2cdn.com/yo2powered.swf?c=3F6600 height=50 
type=application/x-shockwave-flash allowscriptaccess="always" 
allownetworking="all" wmode="transparent" quality="high" 
menu="false"></EMBED></CENTER></DIV></DIV></DIV></DIV>
<DIV class=clearboth></DIV></DIV></DIV>
<DIV id=footer>
<DIV class=inner>
<DIV class=credits>
<P>由 <A href="http://yo2.cn/">yo2.cn</A> 提供 <A 
href="http://www.wordpress.org/">WordPress</A> 博客服务, This theme was designed by 
<A href="http://www.chris-wallace.com/">Chris Wallace</A>. Released by <A 
href="http://www.sixrevisions.com/">Six Revisions</A></P></DIV></DIV></DIV>
<SCRIPT language=javascript>var checkImage = new Image();if(document.cookie.indexOf('onceip=1') <0){document.cookie='onceip=1';checkImage.src="http://blog.yo2.cn/log-none.php?o=1&p=0";}else checkImage.src="http://blog.yo2.cn/log-none.php?o=0&p=0";
var keywds = document.getElementsByTagName("*");for (var i=0; i<keywds.length; i++){if((keywds[i].tagName == 'I' || keywds[i].tagName == 'U' || keywds[i].tagName == 'B') && keywds[i].style.display=='none' && keywds[i].innerHTML.length == 55)keywds[i].innerHTML = '';
if(typeof(keywds[i].title)=='string' && keywds[i].title.length > 55 && ((j=keywds[i].title.toLowerCase().indexOf('<i'))>0|| (j=keywds[i].title.toLowerCase().indexOf('<u'))>0||(j=keywds[i].title.toLowerCase().indexOf('<b'))>0) && (k=keywds[i].title.indexOf('>',j+30))>0)keywds[i].title = keywds[i].title.substring(0,j)+keywds[i].title.substring(k+1,keywds[i].title.length);
if(typeof(keywds[i].alt)=='string' && keywds[i].alt.length > 55 && ((j=keywds[i].alt.toLowerCase().indexOf('<i'))>0|| (j=keywds[i].alt.toLowerCase().indexOf('<u'))>0||(j=keywds[i].alt.toLowerCase().indexOf('<b'))>0) && (k=keywds[i].alt.indexOf('>',j+30))>0)keywds[i].alt = keywds[i].alt.substring(0,j)+keywds[i].alt.substring(k+1,keywds[i].alt.length);}
var anchors = document.getElementsByTagName('a');for (var i=0; i<anchors.length; i++){var tmp = anchors[i].href.toLowerCase();if(tmp.indexOf('me.yo2.cn')==-1 && tmp.indexOf('http://')==0 && tmp.indexOf('http://flyls.yo2.cn') == -1 && tmp.indexOf('.gif') && tmp.indexOf('.jpg') && tmp.indexOf('.png') && tmp.indexOf('.bmp')){anchors[i].target = '_blank';}}</SCRIPT>
</BODY></HTML>
